package com.jinyu.dao.entity.sys;

import com.jinyu.common.enums.DeviceTypeEnum;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;
import java.io.Serializable;

/**
 * @Author: yangli
 * @Despriction:    登录信息
 * @Package: com.jinyu.dao.entity.sys
 * @Date:Created in 2022/5/4 22:38
 * @Modify By:
 */
@Data
public class LoginModel implements Serializable {

    @Serial
    private static final long serialVersionUID = 7934626559006213219L;


    /**
     * 登录类型 1账号密码 2 手机号
     */
    @NotNull(message = "登录类型")
    Integer loginType;

    /**
     *  账号
     */
    @NotEmpty(message = "请输入您的账号")
    @Pattern(regexp = "^(?!_)(?!.*?_$)[0-9a-zA-Z_]{1,20}$", message = "用户编码必须是由英文、数字、下划线组成，且下划线不能在头部或者末尾")
    private String userName;


    /**
     *  密码
     */
    @NotNull(message = "请输入密码")
    @Length(min = 6,max = 20,message = "长度至少6位，至多20位")
    private String passWord;

    /**
     *  登录设备类型
     */
    private String deviceType = DeviceTypeEnum.PC.getType();

    /**
     *  是否记住
     */
    private boolean rememberMe = true;


}
